package com.zr.controller;
/**
 * 
 * @author CY
 *
 */
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.UserService;
import com.zr.serviceImpl.UserServiceImpl;

import net.sf.json.JSONObject;



public class AttendanceByIdController extends HttpServlet{
	private static final long serialVersionUID = 1L;
	UserService user = new UserServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setCharacterEncoding("utf8");
		int did = Integer.parseInt(req.getParameter("did"));
		int page = Integer.parseInt(req.getParameter("page"));
		int rows = Integer.parseInt(req.getParameter("rows"));
		PrintWriter  pw = resp.getWriter();
		JSONObject j = user.getUserEntry(did, page, rows);
		pw.write(j.toString());
		pw.flush();
		pw.close();
	}
}
